import { BasicColumn } from '/@/components/Table/src/types/table';
import { FormSchema } from '/@/components/Form';
import { FormProps } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';

import { GetWorkflowWebTypeData } from '/@/api/demo/flow';
import { Getallpersondto } from '/@/api/demo/system';

const { t } = useI18n();

// 获取所有流程模板数据
export function getFlowComponentColumns(): BasicColumn[] {
  return [
    {
      title: '组件名称',
      dataIndex: 'name',
      fixed: 'left',
      width: 300,
    },
  ];
}

// 获取新增流程模板表单
export function getCreateFlowTemplate(isUpdate): FormSchema[] {
  return [
    {
      field: 'wfid',
      component: 'Input',
      label: t('routes.table.CreateFlowTemplateForm.code'),
      required: true,
      dynamicDisabled: () => {
        return isUpdate.value;
      },
      componentProps: {
        placeholder: t('routes.table.CreateFlowTemplateForm.codePlaceholder'),
      },
    },
    {
      field: 'wfname',
      component: 'Input',
      label: t('routes.table.CreateFlowTemplateForm.name'),
      required: true,
      componentProps: {
        placeholder: t('routes.table.CreateFlowTemplateForm.namePlaceholder'),
      },
    },
    {
      field: 'remark',
      component: 'InputTextArea',
      label: t('routes.table.CreateFlowTemplateForm.workDescription'),
      componentProps: {
        placeholder: t('routes.table.CreateFlowTemplateForm.workDescriptionPlaceholder'),
      },
    },
    {
      field: 'actor',
      component: 'ApiSelect',
      label: t('routes.table.CreateFlowTemplateForm.responsiblePerson'),
      defaultValue: 'sa',
      componentProps: {
        disabled: true,
        placeholder: t('routes.table.CreateFlowTemplateForm.responsiblePersonPlaceholder'),
        api: Getallpersondto,
        labelField: 'name',
        valueField: 'id',
      },
    },
    {
      field: 'classApplicable',
      component: 'ApiTreeSelect',
      label: t('routes.table.CreateFlowTemplateForm.applicableObject'),
      componentProps: {
        placeholder: t('routes.table.CreateFlowTemplateForm.applicableObjectPlaceholder'),
        api: GetWorkflowWebTypeData,
        treeCheckable: true,
      },
    },
    {
      field: 'bzxz',
      component: 'RadioGroup',
      label: t('routes.table.CreateFlowTemplateForm.stepSelection'),
      componentProps: {
        defaultValue: '1',
        options: [
          {
            value: '0',
            label: t('routes.table.CreateFlowTemplateForm.unifiedSetting'),
          },
          {
            value: '1',
            label: t('routes.table.CreateFlowTemplateForm.processInstanceSetting'),
          },
        ],
      },
    },
    {
      field: 'bzxzselected',
      component: 'Checkbox',
      label: t('routes.table.CreateFlowTemplateForm.DynamicShunting'),
      helpMessage: t('routes.table.CreateFlowTemplateForm.allowStepSelection'),
    },
    {
      field: 'htfs',
      component: 'RadioGroup',
      label: t('routes.table.CreateFlowTemplateForm.backStep'),
      componentProps: {
        defaultValue: '1',
        options: [
          {
            value: '0',
            label: t('routes.table.CreateFlowTemplateForm.unifiedSetting'),
          },
          {
            value: '1',
            label: t('routes.table.CreateFlowTemplateForm.processInstanceSetting'),
          },
        ],
      },
    },
    {
      field: 'htfsselected',
      component: 'Checkbox',
      label: t('routes.table.CreateFlowTemplateForm.freeBack'),
    },
    {
      field: 'type',
      component: 'Select',
      label: t('routes.table.CreateFlowTemplateForm.processType'),
      componentProps: {
        defaultValue: '通知流程',
        options: [
          {
            value: '通知流程',
            label: t('routes.table.CreateFlowTemplateForm.noticeProcess'),
          },
          {
            value: '发布流程',
            label: t('routes.table.CreateFlowTemplateForm.publishProcess'),
          },
          {
            value: '外发流程',
            label: t('routes.table.CreateFlowTemplateForm.externalProcess'),
          },
          {
            value: '变更流程',
            label: t('routes.table.CreateFlowTemplateForm.changeProcess'),
          },
          {
            value: '检出流程',
            label: t('routes.table.CreateFlowTemplateForm.checkoutProcess'),
          },
          {
            value: '检入流程',
            label: t('routes.table.CreateFlowTemplateForm.checkinProcess'),
          },
          {
            value: '借阅流程',
            label: t('routes.table.CreateFlowTemplateForm.borrowProcess'),
          },
          {
            value: '废止流程',
            label: t('routes.table.CreateFlowTemplateForm.abolishProcess'),
          },
          {
            value: '编码申请流程',
            label: t('routes.table.CreateFlowTemplateForm.codeApplyProcess'),
          },
        ],
      },
    },
    {
      field: 'signature',
      component: 'Checkbox',
      label: t('routes.table.CreateFlowTemplateForm.TechnicalSeal'),
    },
  ];
}

// 获取父级已办/待办流程数据
export function getFlowDoneColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.flowTodoList.approvalProcess'),
      dataIndex: 'workflow',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.table.flowTodoList.approvalStep'),
      dataIndex: 'step',
      width: 200,
    },
    {
      title: t('routes.table.flowTodoList.project'),
      dataIndex: 'projname',
      width: 200,
    },
    {
      title: t('routes.table.flowTodoList.task'),
      dataIndex: 'taskname',
      slots: { customRender: 'taskname' },
      width: 200,
    },
    {
      title: t('routes.table.flowTodoList.code'),
      dataIndex: 'dh',
      width: 400,
    },
    {
      title: t('routes.table.flowTodoList.backStep'),
      dataIndex: 'backstep',
      width: 200,
    },
    {
      title: t('routes.table.flowTodoList.changeStatus'),
      dataIndex: 'changestate',
      width: 100,
    },
    {
      title: t('routes.table.flowTodoList.createTime'),
      dataIndex: 'createtime',
      slots: { customRender: 'createtime' },
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.planEndTime'),
      dataIndex: 'planendtime',
      slots: { customRender: 'planendtime' },
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.endTime'),
      dataIndex: 'endtime',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.workDescription'),
      dataIndex: 'description',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.responsiblePerson'),
      dataIndex: 'actor',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.allowAdjustment'),
      dataIndex: 'attr',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.creator'),
      dataIndex: 'creator',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.remark'),
      dataIndex: 'remake',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.approvalAuthority'),
      dataIndex: 'popedom',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.securityLevel'),
      dataIndex: 'securityLevel',
      width: 150,
    },
  ];
}

// 获取子级已办/待办流程数据
export function getChildFlowDoneColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.flowChildTodoList.code'),
      dataIndex: 'dh',
      width: 200,
    },
    {
      title: t('routes.table.flowChildTodoList.assessment'),
      dataIndex: 'score',
      width: 100,
    },
    {
      title: t('routes.table.flowChildTodoList.fileName'),
      dataIndex: 'filename',
      width: 100,
    },
    {
      title: t('routes.table.flowChildTodoList.type'),
      dataIndex: 'step',
      width: 100,
    },
    {
      title: '图档分类',
      dataIndex: 'isRoot',
      width: 100,
      slots: { customRender: 'isRoot' },
    },
  ];
}

// 获取父级已办/待办流程搜索数据
export function getHistorySearch(): Partial<FormProps> {
  return {
    labelWidth: 150,
    colon: false, // 是否显示冒号
    schemas: [
      {
        field: `type`,
        label: t('routes.table.ProcessInstanceList.createOrEnd'),
        component: 'Select',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.ProcessInstanceList.createOrEndPlaceholder'),
          options: [
            {
              value: '0',
              label: t('routes.table.ProcessInstanceList.createOrEndByCreate'),
            },
            {
              value: '1',
              label: t('routes.table.ProcessInstanceList.createOrEndByEnd'),
            },
          ],
        },
      },
      {
        field: `selectStr`,
        label: t('routes.table.ProcessInstanceList.keyword'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.ProcessInstanceList.keywordPlaceholder'),
        },
      },
      {
        field: `planTime`,
        label: t('routes.table.ProcessInstanceList.startToEnd'),
        component: 'RangePicker',
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
    ],
    fieldMapToTime: [['planTime', ['startTime', 'endTime'], 'YYYY-MM-DD']],
  };
}

// 流程选择表格数据
export function getFlowSelectColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.flowTodoList.nextWork'),
      dataIndex: 'step',
      fixed: 'left',
      width: 250,
    },
    {
      title: t('routes.table.flowTodoList.responsiblePersonCode'),
      dataIndex: 'actor',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.responsiblePersonName'),
      dataIndex: 'name',
      width: 150,
    },
  ];
}

// 流程选择表格数据
export function getFlowBackColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.flowTodoList.nextWork'),
      dataIndex: 'stepName',
      fixed: 'left',
      width: 250,
    },
    {
      title: t('routes.table.flowTodoList.responsiblePersonCode'),
      dataIndex: 'actor',
      width: 150,
    },
    {
      title: t('routes.table.flowTodoList.responsiblePersonName'),
      dataIndex: 'actorName',
      width: 150,
    },
  ];
}

// 流程步骤表格
export function getFlowStepColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.step'),
      dataIndex: 'id',
      fixed: 'left',
      width: 300,
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.principalCode'),
      dataIndex: 'actor',
      width: 100,
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.principalHandleWay'),
      dataIndex: 'process',
      width: 120,
      slots: { customRender: 'process' }, // 7 在建立工作流实例时指定负责人 1 在模板中指定负责人
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.workDescription'),
      dataIndex: 'description',
      width: 200,
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.overdueMessageReceiverWay'),
      dataIndex: 'msgOverTimeHandWay',
      width: 300,
      slots: { customRender: 'msgOverTimeHandWay' }, // 1 在建立工作流实例时允许修改消息接收人 2 在建立工作流实例时不允许修改消息接收人
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.overdueMessageReceiver'),
      dataIndex: 'overTimeMsgReciver',
      width: 120,
      slots: { customRender: 'overTimeMsgReciver' },
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.finishMessageReceiverWay'),
      dataIndex: 'msgFinishWay',
      width: 300,
      slots: { customRender: 'msgFinishWay' }, // 1 在建立工作流实例时允许修改消息接收人 2 在建立工作流实例时不允许修改消息接收人
      ellipsis: true,
    },
    {
      title: t('routes.demo.workFlow.startFlow.stepSet.stepTable.finishMessageReceiver'),
      dataIndex: 'msgFinsihReciver',
      width: 120,
      slots: { customRender: 'msgFinsihReciver' },
      ellipsis: true,
    },
  ];
}

// 流程对象表格
export function getFlowObjColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.workFlow.startFlow.objectSet.name'),
      dataIndex: 'name',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.workFlow.startFlow.objectSet.version'),
      dataIndex: 'version',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.startFlow.objectSet.type'),
      dataIndex: 'type',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.startFlow.objectSet.creator'),
      dataIndex: 'creator',
      width: 110,
    },
    {
      title: '所属步骤',
      dataIndex: 'stepInstanceId',
      width: 110,
    },
  ];
}

// 流程参考文档表格
export function getFlowDocColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.workFlow.startFlow.referenceDocumentSet.name'),
      dataIndex: 'name',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.startFlow.referenceDocumentSet.version'),
      dataIndex: 'version',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.startFlow.referenceDocumentSet.type'),
      dataIndex: 'type',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.startFlow.referenceDocumentSet.creator'),
      dataIndex: 'creator',
      width: 110,
    },
  ];
}

// 选择流程表格
export function getSelectionColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.workFlow.selectProcessTable.code'),
      dataIndex: 'wfid',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.workFlow.selectProcessTable.name'),
      dataIndex: 'wfname',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.selectProcessTable.objectType'),
      dataIndex: 'classApplicable',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.selectProcessTable.principal'),
      dataIndex: 'actor',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.selectProcessTable.createUser'),
      dataIndex: 'creator',
      width: 110,
    },
    {
      title: t('routes.demo.workFlow.selectProcessTable.remark'),
      dataIndex: 'remark',
      width: 110,
    },
  ];
}

// 调整步骤负责人表格
export function getAdjustColumns(): BasicColumn[] {
  return [
    {
      title: '登录名',
      dataIndex: 'id',
      width: 110,
    },
    {
      title: '名称',
      dataIndex: 'name',
      width: 110,
    },
  ];
}

// 我的流程表格
export function getMyWorkFlowColumns(): BasicColumn[] {
  return [
    {
      title: '名称',
      dataIndex: 'name',
      fixed: 'left',
      width: 300,
    },
    {
      title: '图档代号',
      dataIndex: 'dh',
      width: 300,
    },
    {
      title: '标签',
      dataIndex: 'label',
      width: 100,
    },
    {
      title: '关键字',
      dataIndex: 'keyWord',
      width: 100,
    },
    {
      title: '当前持有者',
      dataIndex: 'currentHolder',
      width: 100,
    },
    {
      title: '类型',
      dataIndex: 'type',
      width: 100,
    },
  ];
}

// 我的流程子表格
export function getChildMyWorkFlowColumns(): BasicColumn[] {
  return [
    {
      title: '表单名称',
      dataIndex: 'formName',
      fixed: 'left',
      width: 200,
    },
    {
      title: '创建人',
      dataIndex: 'creater',
      width: 110,
    },
    {
      title: '生效状态',
      dataIndex: 'status',
      width: 110,
      slots: { customRender: 'status' },
    },
    {
      title: '创建时间',
      dataIndex: 'createTime',
      width: 110,
      slots: { customRender: 'createTime' },
    },
  ];
}

export function flowExampleColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.flowExampleList.code'),
      dataIndex: 'id',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.table.flowExampleList.name'),
      dataIndex: 'name',
      width: 150,
    },
    {
      title: t('routes.table.flowExampleList.workflowTemplate'),
      dataIndex: 'workflow',
      width: 150,
    },
    {
      title: t('routes.table.flowExampleList.changeStatus'),
      dataIndex: 'state',
      width: 120,
    },
    {
      title: t('routes.table.flowExampleList.createTime'),
      dataIndex: 'createTime',
      width: 150,
      slots: { customRender: 'createTime' },
    },
    {
      title: t('routes.table.flowExampleList.responsiblePerson'),
      dataIndex: 'actor',
      width: 120,
    },
    {
      title: t('routes.table.flowExampleList.startTime'),
      dataIndex: 'startTime',
      width: 150,
      slots: { customRender: 'startTime' },
    },
    {
      title: t('routes.table.flowExampleList.overTime'),
      dataIndex: 'EstCostTime',
      width: 150,
      slots: { customRender: 'EstCostTime' },
    },
    {
      title: t('routes.table.flowExampleList.planEndTime'),
      dataIndex: 'EstEndTime',
      width: 150,
      slots: { customRender: 'EstEndTime' },
    },
    {
      title: t('routes.table.flowExampleList.endTime'),
      dataIndex: 'endTime',
      width: 150,
      slots: { customRender: 'endTime' },
    },
    {
      title: t('routes.table.flowExampleList.creator'),
      dataIndex: 'creator',
      width: 120,
    },
    {
      title: t('routes.table.flowExampleList.processMethod'),
      dataIndex: 'UntreadSel',
      width: 120,
    },
    {
      title: t('routes.table.flowExampleList.remark'),
      dataIndex: 'remark',
      width: 120,
    },
    {
      title: t('routes.table.flowExampleList.securityLevel'),
      dataIndex: 'securityLevel',
      width: 120,
    },
  ];
}

export function flowExampleSearch(): Partial<FormProps> {
  return {
    labelWidth: 100,
    colon: true, // 是否显示冒号
    schemas: [
      {
        field: `id`,
        label: t('routes.table.flowExampleList.code'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.flowExampleList.codePlaceholder'),
        },
      },
      {
        field: `name`,
        label: t('routes.table.flowExampleList.name'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.flowExampleList.namePlaceholder'),
        },
      },
      {
        field: `workflow`,
        label: t('routes.table.flowExampleList.workflowTemplate'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.flowExampleList.workflowTemplatePlaceholder'),
        },
      },
      {
        field: `state`,
        label: t('routes.table.flowExampleList.changeStatus'),
        component: 'Select',
        componentProps: {
          placeholder: t('routes.table.flowExampleList.changeStatusPlaceholder'),
          options: [
            {
              value: '完成',
              label: '完成',
            },
            {
              value: '运行',
              label: '运行',
            },
            {
              value: '暂停',
              label: '暂停',
            },
          ],
        },
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
      {
        field: `actor`,
        label: t('routes.table.flowExampleList.responsiblePerson'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.flowExampleList.responsiblePersonPlaceholder'),
          api: Getallpersondto,
          labelField: 'name',
          valueField: 'id',
        },
      },
      {
        field: `creator`,
        label: t('routes.table.flowExampleList.creator'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.flowExampleList.creatorPlaceholder'),
          api: Getallpersondto,
          labelField: 'name',
          valueField: 'id',
        },
      },
      {
        field: `realTime`,
        label: t('routes.table.flowExampleList.time'),
        component: 'RangePicker',
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
    ],
    fieldMapToTime: [['realTime', ['estStartTime', 'EstEndTime'], 'YYYY-MM-DD']],
  };
}

export function AnnotationInfo(): FormSchema[] {
  return [
    {
      field: 'thitObjId',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.code'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'version',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.version'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'fileName',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.name'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'fileType',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.type'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'steps',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.step'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'postilData',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.content'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'userid',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.person'),
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'postilTime',
      component: 'Input',
      label: t('routes.table.AnnotationInfoList.time'),
      componentProps: {
        disabled: true,
      },
    },
  ];
}

export function geFormColumns(): BasicColumn[] {
  return [
    {
      title: '表单属性',
      dataIndex: 'name',
      fixed: 'left',
      width: 200,
    },
    {
      title: '浏览',
      dataIndex: 'isView',
      width: 100,
      slots: { customRender: 'isView' },
    },
    {
      title: '编辑',
      dataIndex: 'isEdit',
      width: 100,
      slots: { customRender: 'isEdit' },
    },
    {
      title: '必填',
      dataIndex: 'isRequired',
      width: 100,
      slots: { customRender: 'isRequired' },
    },
  ];
}

export function getBasicInfo(): FormSchema[] {
  return [
    {
      field: 'name',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.name'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.propertySet.namePlaceholder'),
      },
    },
    {
      field: 'code',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.code'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.propertySet.codePlaceholder'),
      },
      slot: 'code',
    },
    {
      field: 'startTime',
      component: 'DatePicker',
      label: t('routes.demo.workFlow.startFlow.propertySet.startTime'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.propertySet.startTimePlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'principal',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.principal'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.propertySet.principalPlaceholder'),
        disabled: true,
      },
    },
    // 0 统一设置 1 流程实例化设置
    {
      field: 'bzxz',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.stepSelect'),
      defaultValue: '',
      ifShow: false,
    },
    {
      field: 'stepSelect',
      component: 'Checkbox',
      label: t('routes.demo.workFlow.startFlow.propertySet.stepSelect'),
      defaultValue: false,
      itemProps: {
        labelCol: {
          span: 6,
        },
        wrapperCol: {
          span: 9,
        },
      },
      suffix: t('routes.demo.workFlow.startFlow.propertySet.allowStepSelect'),
      dynamicDisabled: ({ values }) => {
        return values.bzxz == '0';
      },
    },
    // 0 统一设置 1 流程实例化设置
    {
      field: 'htfs',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.backMethod'),
      defaultValue: '',
      ifShow: false,
    },
    {
      field: 'backMethod',
      component: 'RadioGroup',
      label: t('routes.demo.workFlow.startFlow.propertySet.backMethod'),
      defaultValue: '0',
      componentProps: {
        options: [
          {
            label: t('routes.demo.workFlow.startFlow.propertySet.backMethodCustom'),
            value: '0',
          },
          {
            label: t('routes.demo.workFlow.startFlow.propertySet.backMethodSelect'),
            value: '1',
          },
        ],
      },
      dynamicDisabled: ({ values }) => {
        return values.htfs == '0';
      },
    },
    {
      field: 'overdueTime',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.overdueTime'),
      slot: 'overdueTime',
      defaultValue: '',
    },
    {
      field: 'overdueTimeDay',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.overdueTime'),
      defaultValue: '',
      ifShow: false,
    },
    {
      field: 'overdueTimeHour',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.propertySet.overdueTime'),
      defaultValue: '',
      ifShow: false,
    },
    // 1 允许 2 不允许
    {
      field: 'overDueFormHandleWay',
      component: 'Input',
      label: '超时处理方式',
      defaultValue: '',
      ifShow: false,
    },
    // 1 允许 2 不允许
    {
      field: 'messageFormHandleWay',
      component: 'Input',
      label: '消息处理方式',
      defaultValue: '',
      ifShow: false,
    },
    {
      field: 'overdueMessageReceiver',
      component: 'ApiSelect',
      label: t('routes.demo.workFlow.startFlow.propertySet.overdueMessageReceiver'),
      defaultValue: '',
      componentProps: {
        placeholder: t(
          'routes.demo.workFlow.startFlow.propertySet.overdueMessageReceiverPlaceholder',
        ),
        api: Getallpersondto,
        labelField: 'name',
        valueField: 'id',
        showSearch: true,
        filterOption: (input: string, option: any) => {
          return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
        },
        getPopupContainer: () => document.body,
      },
      dynamicDisabled: ({ values }) => {
        return values.messageFormHandleWay == '2';
      },
    },
  ];
}

export function getStepColumns(): BasicColumn[] {
  return [
    {
      title: '表单属性',
      dataIndex: 'name',
      fixed: 'left',
      width: 200,
    },
    {
      title: '浏览',
      dataIndex: 'isView',
      width: 100,
      slots: { customRender: 'isView' },
    },
    {
      title: '编辑',
      dataIndex: 'isEdit',
      width: 100,
      slots: { customRender: 'isEdit' },
    },
    {
      title: '必填',
      dataIndex: 'isRequired',
      width: 100,
      slots: { customRender: 'isRequired' },
    },
  ];
}

export function getStepInfo(): FormSchema[] {
  return [
    {
      field: 'shortId',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.stepSet.name'),
      ifShow: false,
    },
    {
      field: 'actor',
      component: 'ApiSelect',
      label: t('routes.demo.workFlow.startFlow.propertySet.principal'),
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.propertySet.principalPlaceholder'),
        api: Getallpersondto,
        labelField: 'name',
        valueField: 'id',
        showSearch: true,
        filterOption: (input: string, option: any) => {
          return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
        },
        getPopupContainer: () => document.body,
      },
    },
    {
      field: 'stepOverTimes',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.stepSet.overdueTime'),
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.stepSet.overdueTimePlaceholder'),
      },
      slot: 'overdueTime',
    },
    {
      field: 'stepOverHours',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.stepSet.overdueTime'),
      ifShow: false,
    },
    {
      field: 'stepOverDays',
      component: 'Input',
      label: t('routes.demo.workFlow.startFlow.stepSet.overdueTime'),
      ifShow: false,
    },
    {
      field: 'description',
      component: 'InputTextArea',
      label: t('routes.demo.workFlow.startFlow.stepSet.workDescription'),
    },
    {
      field: 'overTimeMsgReciver',
      component: 'ApiSelect',
      label: t('routes.demo.workFlow.startFlow.stepSet.stepTable.overdueMessageReceiver'),
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.stepSet.adjustMessageReceiver'),
        api: Getallpersondto,
        labelField: 'name',
        valueField: 'id',
        showSearch: true,
        filterOption: (input: string, option: any) => {
          return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
        },
        getPopupContainer: () => document.body,
      },
    },
    {
      field: 'msgFinsihReciver',
      component: 'ApiSelect',
      label: t('routes.demo.workFlow.startFlow.stepSet.stepTable.finishMessageReceiver'),
      componentProps: {
        placeholder: t('routes.demo.workFlow.startFlow.stepSet.adjustMessageReceiver'),
        api: Getallpersondto,
        labelField: 'name',
        valueField: 'id',
        showSearch: true,
        filterOption: (input: string, option: any) => {
          return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
        },
        getPopupContainer: () => document.body,
      },
    },
  ];
}
